<%@ page import="gdepot.Category" %>



<div class="fieldcontain ${hasErrors(bean: categoryInstance, field: 'categoryName', 'error')} required">
	<label for="categoryName">
		<g:message code="category.categoryName.label" default="Category Name" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="categoryName" required="" value="${categoryInstance?.categoryName}"/>

</div>

<div class="fieldcontain ${hasErrors(bean: categoryInstance, field: 'children', 'error')} ">
	<label for="children">
		<g:message code="category.children.label" default="Children" />
		
	</label>
	
<ul class="one-to-many">
<g:each in="${categoryInstance?.children?}" var="c">
    <li><g:link controller="category" action="show" id="${c.id}">${c?.encodeAsHTML()}</g:link></li>
</g:each>
<li class="add">
<g:link controller="category" action="create" params="['category.id': categoryInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'category.label', default: 'Category')])}</g:link>
</li>
</ul>


</div>

<div class="fieldcontain ${hasErrors(bean: categoryInstance, field: 'goods', 'error')} ">
	<label for="goods">
		<g:message code="category.goods.label" default="Goods" />
		
	</label>
	
<ul class="one-to-many">
<g:each in="${categoryInstance?.goods?}" var="g">
    <li><g:link controller="goods" action="show" id="${g.id}">${g?.encodeAsHTML()}</g:link></li>
</g:each>
<li class="add">
<g:link controller="goods" action="create" params="['category.id': categoryInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'goods.label', default: 'Goods')])}</g:link>
</li>
</ul>


</div>

<div class="fieldcontain ${hasErrors(bean: categoryInstance, field: 'parentCategory', 'error')} required">
	<label for="parentCategory">
		<g:message code="category.parentCategory.label" default="Parent Category" />
		<span class="required-indicator">*</span>
	</label>
	<g:select id="parentCategory" name="parentCategory.id" from="${gdepot.Category.list()}" optionKey="id" required="" value="${categoryInstance?.parentCategory?.id}" class="many-to-one"/>

</div>

<g:hiddenField name="user.id" value="${session.user.id}"/>